import 'package:flutter/material.dart';
import 'custom_route.dart';

class FirstPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.blue,
      appBar: AppBar(
        title: Text(
          '第一个页面',
          style: TextStyle(fontSize: 36.0),
        ),
        elevation: 0.0, //appBar和页面的融合默认4.0
      ),
      body: Center(
        child: MaterialButton(
          child: Icon(
            Icons.navigate_next,
            size: 64.0,
          ),
          onPressed: () {
            Navigator.of(context).push(CustomRoute(SecondPage()));
          },
        ),
      ),
    );
  }
}

class SecondPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          '第二个页面',
          style: TextStyle(fontSize: 36.0),
        ),
        backgroundColor: Colors.red,
        elevation: 0.0, //appBar和页面的融合
      ),
      backgroundColor: Colors.red,
      body: Center(
        child: MaterialButton(
          child: Icon(
            Icons.navigate_before,
            size: 64.0,
          ),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
      ),
    );
  }
}
